#ifndef SEGMENTLIST_H
#define SEGMENTLIST_H

/**
 * \file	segmentlist.h
 * \brief	Declaration de la classe SegmentList representant une liste de segment.
 */

#include "segment.h"

class SegmentList
{
	/*!
	 * \class SegmentList
	 * \brief Classe représentant une liste de segments.
	 * 
	 * Classe représentant une liste de segments.
	 * Donne des outils plus elabores et plus specifiques que les outils standard des listes en c++.
	 *
	 */
	private :
		list<Segment*>	segments;										/*! Liste de segments.*/
		
	public:
		/*!
		*  \brief Default constructor of the SegmentList class.
		*
		*  Default constructor of the SegmentList class : Every attributes are initialized to 0 (int,float,double,...) NULL (pointers) or are cleared (lists, stacks, ...).
		*/
		SegmentList();
		
		/*!
		*  \brief Copy constructor of the SegmentList class.
		*
		*  Copy constructor of the SegmentList class.
		*/
		SegmentList( const SegmentList& _sl );
		
		/*!
		*  \brief Destructor of the SegmentList class.
		*
		*  Destructor of the SegmentList class.
		*/
		~SegmentList();
		
		/*!
		*  \brief Affectation operator of the SegmentList class.
		*
		*  Affectation operator of the SegmentList class.
		*/
		SegmentList& operator= ( const SegmentList& _sl );
		
		/*!
		*  \brief Getter of the SegmentList class.
		*
		*  Getter of the SegmentList class.
		*
		*  \return (list<Segment*>) Returns the list of the SegmentList.
		*/
		list<Segment*> getSegments();

		/*!
		*  \brief Getter of the SegmentList class.
		*
		*  Getter of the SegmentList class.
		*
		*  \return (list<Segment*>::iterator) Returns the begin iterator of the SegmentList.
		*/
		list<Segment*>::iterator getBegin();
		
		/*!
		*  \brief Getter of the SegmentList class.
		*
		*  Getter of the SegmentList class.
		*
		*  \return (list<Segment*>::iterator) Returns the end iterator of the SegmentList.
		*/
		list<Segment*>::iterator getEnd();

		/*!
		*  \brief Setter of the SegmentList class.
		*
		*  Setter of the SegmentList class.
		*
		*  \param _sl : List to attribuate to the segmentlist.
		*
		*  \return (void)
		*/
		void setSegments ( list<Segment*> _sl );
		
		/*!
		*  \brief Clears a segment list.
		*
		*  Clears a segment list.
		*
		*  \return (void)
		*/
		void clear();
		
		/*!
		*  \brief Creates a list of segments from a map.
		*
		*  Creates a list of segments from a map based on the "Equal" criteria.
		*
		*  \param _thresh : value to verify the criteria.
		*  \param _mesh : mesh we want to compute the segments.
		*  \param _map : map paired with the mesh describing each vertex value.
		*
		*  \return (void)
		*/
		void createFromMap_Eq ( double _thresh, Mesh _mesh, Map _map );
		
		/*!
		*  \brief Creates a list of segments from a map.
		*
		*  Creates a list of segments from a map based on the "Less or equal" criteria.
		*
		*  \param _thresh : value to verify the criteria.
		*  \param _mesh : mesh we want to compute the segments.
		*  \param _map : map paired with the mesh describing each vertex value.
		*
		*  \return (void)
		*/
		void createFromMap_LeEq ( double _thresh, Mesh _mesh, Map _map );
		
		/*!
		*  \brief Creates a list of segments from a map.
		*
		*  Creates a list of segments from a map based on the "Greater or equal" criteria.
		*
		*  \param _thresh : value to verify the criteria.
		*  \param _mesh : mesh we want to compute the segments.
		*  \param _map : map paired with the mesh describing each vertex value.
		*
		*  \return (void)
		*/
		void createFromMap_GrEq ( double _thresh, Mesh _mesh, Map _map );
		
		/*!
		*  \brief Adds a segment to a list of segment.
		*
		*  Adds a segment to a list of segment.
		*
		*  \param _s : Segment we want to add to the list.
		*
		*  \return (void)
		*/
		void addSegment ( Segment* _s );
		
		/*!
		*  \brief Removes a segment from a list of segment.
		*
		*  Removes a segment from a list of segment.
		*
		*  \param _s : Segment we want to remove from the list.
		*
		*  \return (void)
		*/
		void removeSegment ( Segment* _s );
		
		/*!
		*  \brief Extract (find and remove) the segment from the list which has the minimum depth.
		*
		*  Extract (find and remove) the segment from the list which has the minimum depth.
		*
		*  \return (Segment*) Returns a pointer on the extracted element.
		*/
		Segment* extractMinimumDepth ();
		
		/*!
		*  \brief Extract (find and remove) the segment from the list which has the maximum depth.
		*
		*  Extract (find and remove) the segment from the list which has the maximum depth.
		*
		*  \return (Segment*) Returns a pointer on the extracted element.
		*/
		Segment* extractMaximumDepth ();
		
		/*!
		*  \brief Looks if a specific segment is contained by the list.
		*
		*  Looks if a specific segment is contained by the list.
		*
		*  \param _s : Segment we want to search in the list.
		*
		*  \return (bool) Returns true if the segment has been found, false else.
		*/
		bool contains ( Segment* _s );
		
		/*!
		*  \brief Prints a list of segment in the terminal.
		*
		*  Prints a list of segment in the terminal : prints the number of the current node in the list and its segment's ID.
		*
		*  \return (void)
		*/
		void printIDS ();
		
		/*!
		*  \brief Displays a list of segments.
		*
		*  Displays a list of segments : all segments are display with an openGL routine.
		*
		*  \return (void)
		*/
		void display ();
		
		void display ( int _i );
};

#endif
